"""
CMDB URL Configuration
"""
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

router = DefaultRouter()
router.register(r'projects', views.ProjectViewSet)
router.register(r'environments', views.EnvironmentViewSet)
router.register(r'host-groups', views.HostGroupViewSet)
router.register(r'hosts', views.HostViewSet)
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
router.register(r'roles', views.RoleViewSet)
router.register(r'email-configs', views.EmailConfigViewSet, basename='email-config')
router.register(r'audit-logs', views.AuditLogViewSet, basename='audit-log')
router.register(r'inspection-history', views.InspectionHistoryViewSet, basename='inspection-history')

urlpatterns = [
    path('', include(router.urls)),
    path('register/', views.register, name='register'),
    path('login/', views.login, name='login'),
    path('logout/', views.logout, name='logout'),
    path('current-user/', views.current_user, name='current-user'),
    path('current-user-permissions/', views.current_user_permissions, name='current-user-permissions'),
    path('system-info/', views.system_info, name='system-info'),
    path('host-inspection/', views.host_inspection, name='host-inspection'),
    path('send-inspection-email/', views.send_inspection_email, name='send-inspection-email'),
    path('sync-hosts-status/', views.sync_hosts_status, name='sync-hosts-status'),
    path('hosts/<int:host_id>/power/', views.host_power_action, name='host-power-action'),
    path('hosts/<int:host_id>/auto-get-mac/', views.auto_get_mac_address, name='auto-get-mac'),
    path('hosts/<int:host_id>/test-ssh/', views.test_ssh_connection, name='test-ssh'),
    
    # Ansible Management
    path('ansible/', include('ansible_management.urls')),
]
